<?php

use App\Models\Entrust\Role;
use App\Models\User;
use Illuminate\Database\Seeder;

class SuperAdmin extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        User::where('id', 1)->forceDelete();

        $user = User::create([
            'id' => 1,
            'username' => 'admin',
            'name' => '超级管理员',
            'password' => bcrypt(123456),
        ]);

        $user->roles()->sync(Role::where('name', 'admin')->pluck('id'));
    }
}
